<include file="public@header"/>
<link rel="stylesheet" href="__STATIC__/layui/css/layui.css"/>
<script type="text/javascript" src="__STATIC__/layui/layui.js"></script>

<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
</style>
<script type="text/html" id="photos-item-tpl">
    <li id="saved-image{id}">
        <input id="photo-{id}" type="hidden" name="photo_urls[]" value="{filepath}">
        <input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="imagePreviewDialog(this.src);">
        <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
        <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
    </li>
</script>
<script type="text/html" id="files-item-tpl">
    <li id="saved-file{id}">
        <input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
        <input class="form-control" id="file-{id}-name" type="text" name="file_names[]" value="{name}"
               style="width: 200px;" title="文件名称">
        <a id="file-{id}-preview" href="{preview_url}" target="_blank">下载</a>
        <a href="javascript:uploadOne('图片上传','#file-{id}','file');">替换</a>
        <a href="javascript:(function(){$('#saved-file{id}').remove();})();">移除</a>
    </li>
</script>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('AdminIndex/index')}">会议列表</a></li>
        <li ><a href="{:url('AdminIndex/add')}">添加会议</a></li>
        <li class="active"><a >编辑会议</a></li>
    </ul>
    <form action="{:url('AdminIndex/editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
        <div class="row">
            <div class="col-md-9">
                <table class="table table-bordered">
                    <tr>
                        <th width="160">分类<span class="form-required">*</span></th>
                        <td>
                           <select name="type" class="form-control">
                               <option<if condition="$meet.type == 0"> selected="selected"</if> value="0">不限</option>
                               <foreach name="categories" item="vo">
                                   <option  <if condition="$meet.type == $vo.id"> selected="selected"</if> value="{$vo.id}">{$vo.name}</option>
                               </foreach>
                           </select>
                        </td>
                    </tr>
                    <tr>
                        <th>名称<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" name="name"
                                   id="title" required value="{$meet.name|default=''}" placeholder="请输入标题"/>
                        </td>
                    </tr>
                    <tr>
                        <th>会议地址<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" name="address"
                                   id="address" required value="{$meet.address|default=''}" placeholder="请输入会议地址"/>
                        </td>
                    </tr>
                    <tr>
                        <th>会议开始日期<span class="form-required">*</span></th>
                        <td>
                            <input type="text" class="form-control start_time" name="start_time"
                                   value="{$meet.start_time|date='Y-m-d',###}"
                                   style="width: 140px;" autocomplete="off">
                        </td>
                    </tr>
                    <tr>
                        <th>会议结束日期<span class="form-required">*</span></th>
                        <td>
                            <input type="text" class="form-control end_time" name="end_time"
                                   value="{$meet.end_time|date='Y-m-d',###}"
                                   style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <th>网上注册截止日期<span class="form-required">*</span></th>
                        <td>
                            <input type="text" class="form-control register_end_time" name="register_end_time"
                                   value="{$meet.register_end_time|date='Y-m-d',###}"
                                   style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <th>现场报到日期<span class="form-required">*</span></th>
                        <td>
                            <input type="text" class="form-control signed_time" name="signed_time"
                                   value="{$meet.signed_time|date='Y-m-d',###}"
                                   style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <th>个人报名费用<span class="form-required">*</span></th>
                        <td>
                            <input type="text" class="form-control person_price" value="{$meet.person_price|default=0}" name="person_price"
                                   style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <th>单位报名费用<span class="form-required">*</span></th>
                        <td>
                            <input type="text" class="form-control unit_price" value="{$meet.unit_price|default=0}" name="unit_price"
                                   style="width: 140px;" autocomplete="of">
                        </td>
                    </tr>
                    <tr>
                        <th>主办单位<span class="form-required">*</span></th>
                        <td><input class="form-control" type="text" name="unit_zb"  value="{$meet.unit_zb|default=''}"
                                   placeholder="主办单位"></td>
                    </tr>
                    <tr>
                        <th>承办单位<span class="form-required">*</span></th>
                        <td><input class="form-control" type="text" name="unit_zengb"  value="{$meet.unit_zengb|default=''}"
                                   placeholder="承办单位"></td>
                    </tr>
                    <tr>
                        <th>协办单位<span class="form-required">*</span></th>
                        <td><input class="form-control" type="text" name="unit_xieban" id="source" value="{$meet.unit_xieban|default=''}"
                                   placeholder="协办单位"></td>
                    </tr>

                    <tr>
                        <th>会议简介<span class="form-required">*</span></th>
                        <td>
                            <script type="text/plain" id="info" name="info">{:htmlspecialchars_decode($meet.info)}</script>
                        </td>
                    </tr>
                    <tr>
                        <th>基本信息<span class="form-required">*</span></th>
                        <td>
                            <script type="text/plain" id="basic_info" name="basic_info">{:htmlspecialchars_decode($meet.basic_info)}</script>
                        </td>
                    </tr>
                    <tr>
                        <th>组织结构<span class="form-required">*</span></th>
                        <td>
                            <script type="text/plain" id="zhuzhi_info" name="zhuzhi_info">{:htmlspecialchars_decode($meet.zhuzhi_info)}</script>
                        </td>
                    </tr>
                    <tr>
                        <th>征文投稿<span class="form-required">*</span></th>
                        <td>
                            <script type="text/plain" id="tg_info" name="tg_info">
                                {:htmlspecialchars_decode($meet.tg_info)}
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <th>参会注册<span class="form-required">*</span></th>
                        <td>
                            <script type="text/plain" id="register_info" name="register_info">
                                {:htmlspecialchars_decode($meet.register_info)}
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <th>酒店交通<span class="form-required">*</span></th>
                        <td>
                            <script type="text/plain" id="hotel_info" name="hotel_info">
                                 {:htmlspecialchars_decode($meet.hotel_info)}
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <th>联系我们<span class="form-required">*</span></th>
                        <td>
                            <script type="text/plain" id="contact_info" name="contact_info">
                                  {:htmlspecialchars_decode($meet.contact_info)}
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <th>举办省份<span class="form-required">*</span></th>
                        <td>
                            <select class="form-control" name="province">
                                <foreach name="provinces" item="item">
                                    <option <if condition="$meet.province == $item.provinceid">selected="selected"</if> value="{$item.provinceid}">{$item.province}</option>
                                </foreach>
                            </select>
                        </td>
                    </tr>
                </table>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <input type="hidden" value="{$meet.id}" name="id">
                        <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
                        <a class="btn btn-default" href="{:url('index/index')}">{:lang('BACK')}</a>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                <table class="table table-bordered">
                    <tr>
                        <th><b>缩略图</b></th>
                    </tr>
                    <tr>
                        <td>
                            <div style="text-align: center;">
                                <input type="hidden" name="top_banner" id="thumbnail" value="{$meet.top_banner}">
                                <if condition="empty($meet.top_banner)">
                                <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                                    <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                         id="thumbnail-preview"
                                         width="135" style="cursor: pointer"/>
                                    <else/>
                                    <img src="{:cmf_get_image_preview_url($meet.top_banner)}"
                                         id="thumbnail-preview"
                                         width="135" style="cursor: pointer"/>
                                </a>
                                </if>
                                <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th><b>主题色</b></th>
                    </tr>
                    <tr>
                        <td>
                            <div style="text-align: center;">
                                <select class="form-control" name="theme">
                                    <option value="blue" <if condition="$meet.theme == 'blue'">selected="selected"</if>>蓝色</option>
                                    <option value="red" <if condition="$meet.theme == 'red'">selected="selected"</if>>红色</option>
                                </select>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th><b>状态</b></th>
                    </tr>
                    <tr>
                        <td>
                            <div class="checkbox">
                                <label><input type="checkbox" name="tg_status" value="1"  <if condition="$meet.tg_status == 1">checked</if>>开启投稿</label>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div class="checkbox">
                                <label><input type="checkbox" name="person_status" value="1" <if condition="$meet.person_status == 1">checked</if>>个人会员注册</label>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div class="checkbox">
                                <label><input type="checkbox" name="unit_status" value="1" <if condition="$meet.unit_status == 1">checked</if>>单位会员注册</label>
            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">

    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '.start_time' //指定元素
        });
        laydate.render({
            elem: '.end_time' //指定元素
        });
        laydate.render({
            elem: '.register_end_time' //指定元素
        });
        laydate.render({
            elem: '.signed_time' //指定元素
        });
    });
    $(function () {

        var info = new baidu.editor.ui.Editor();
        var basic_info = new baidu.editor.ui.Editor();
        var tg_info = new baidu.editor.ui.Editor();
        var register_info = new baidu.editor.ui.Editor();
        var hotel_info = new baidu.editor.ui.Editor();
        var contact_info = new baidu.editor.ui.Editor();
        var zhuzhi_info = new baidu.editor.ui.Editor();

        info.render('info');
        contact_info.render('contact_info');
        basic_info.render('basic_info');
        tg_info.render('tg_info');
        register_info.render('register_info');
        hotel_info.render('hotel_info');
        zhuzhi_info.render('zhuzhi_info');

        try {
            info.sync();
            contact_info.sync();
            hotel_info.sync();
            basic_info.sync();
            tg_info.sync();
            register_info.sync();
            zhuzhi_info.sync();
        } catch (err) {
        }

        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });

    });
</script>
</body>
</html>